<script>
	import {setGlobalData, Request,navBarHeight} from './util.js';
	
	const domain = "https://www.henrywong01.top"
	
	setGlobalData('domain', domain);
	
	export default {
		onLaunch: function() {
			//获取导航栏高度并储存在storage
			uni.setStorageSync('navBarHeight', navBarHeight);
			
			//微信登录
			uni.login({
				success: (res) => {
					console.log("code值为"+res.code);
					 //服务端登录请求获取用户openid
					 Request(domain + "/client/user/onLogin",{code: res.code }).then((result)=>{
							const {openid, session_key} = result.data.data;
							uni.setStorageSync("openid",openid); //储存openid
						    uni.setStorageSync("session_key",session_key);
							
					 })
				}
			})
		}
	}
</script>

<style lang="less">
	@import 'uni.less';
	/*每个页面公共css */

</style>
